
package janino.iterator;

import j2me.util.collections.Iterator;
/**
 * An {@link java.util.Iterator} that transforms its elements on-the-fly.
 */
public abstract class TransformingIterator extends FilterIterator {
    public TransformingIterator(Iterator delegate) {
        super(delegate);
    }

    public final Object next() {
        Object next = this.delegate.next();
        return this.transform(next);
    }

    /**
     * Derived classes must implement this method such that it does the
     * desired transformation.
     */
    protected abstract Object transform(Object o);
}
